;;;Inserts a match line along the alignment (requires GPDGN alignment)
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://paracadd.com
;;;	All rights reserved.
;;;
(defun c:mlins ()
  (if(and(>(getvar"cvport")1)(eq(getvar"tilemode")0))
    nil
    (if (eq(getvar"tilemode")0)
      (vla-put-MSpace (vla-get-Activedocument (vlax-get-Acad-Object)) :vlax-true)
;;;      (command "._mspace")
      (princ "\nPaper space is not active")
    )
  )
  (setq firsta (uint 1 "" "Match line beginning station" firsta))
  (setq stainc (uint 1 "" "Match line increment" stainc))
  (setq fircnt 1)
  (while (< fircnt (length align_lst))
    (while (< (nth 1(nth fircnt align_lst)) firsta)
      (setq fircnt (1+ fircnt))
    )
    (if (>= fircnt (length align_lst))
      nil
      (progn
        (setq stangl  (angle
                        (nth 9(nth fircnt align_lst))
                        (nth 9(nth (1- fircnt) align_lst))
                      )
              fsta_pt (polar
                        (nth 9(nth fircnt align_lst))
                        stangl
                        (-(nth 1(nth fircnt align_lst))firsta)
                      )
        )
        (if (= firsta (nth 1(nth(1-(length align_lst))align_lst)))
          nil
          (command "._insert" "ml" fsta_pt 1 1 (*(/ stangl pi)180))
        )
        (setq firsta (+ firsta stainc)
              fircnt (1+ fircnt)
        )
        (if (> firsta (nth 1(nth(1-(length align_lst))align_lst)))
          (setq firsta (nth 1(nth(1-(length align_lst))align_lst)))
        )
      )
    )
  )
  (princ)
);defun
